****************************************************************************************************************************************************************
*REPLICATION MATERIAL FOR
*Däubler, T., Quoss, F., & Rudolph, L.
*Do citizens use sociodemographic characteristics as cues to infer candidate issue positions?
*
*Version 1.0, by Lukas Rudolph
*2021-09-17
****************************************************************************************************************************************************************
/*
Datasets used: 
master_respondents.dta
*/
****************************************************************************************************************************************************************

****************************************************************************************************************************************************************
*This Do-File replicates the results presented in
/*
Table 1: 		Citizens' environmental score as predicted by demographics

Figure 2: 		Treatment increases probability of placement, but only in set of respondents without prior candidate knowledge
Figure 3:		Treatment (revelation of ballot cues on age or rurality) does not affect placement
Figure 4:		Treatment (revelation of ballot cues on age or rurality) does not affect placement within party systematically
Figure 5:		Treatment increases probability of placement, but only if both party-mean and cue treatment are experimentally revealed, and more so with low political interest
Figure 6:		Treatment has no specific effects within populations of high/low political interest
Figure 7:		Predicted candidate placement by whether a respondent is green (above median environmental score) or brown (below median environmental score), by whether the candidate to be placed differs on demographics to the respondent or resembles the respondent, and by treatment group (ballot information not provided vs provided)

Table A.1:		Descriptive Statistics
Table A.5:		A "like-me"-heuristic?
Table A.6:		"Like-me"-heuristic is more pronounced if party mean treatment is also shown
Table A.7:		"Like-me"-heuristic is more pronounced if respondent reports knowing the candidate
Table A.8:		Robustness tests for main effects of Figure 3 with three-categorical and continouus modelling of age and with and without control variables
Table A.9:		Regression table for results presented in Figure 2
Table A.10:		Regression table for results presented in Figure 3
Table A.11:		Regression table for results presented in Figure 4
Table A.12:		Regression table for results presented in Figure 5
Table A.13:		Regression table for results presented in Figure 6

Figure A.1:		Weighted local polynomial smooth plot of environmental score on age
Figure A.2:		Conditional means binary indicator candidate
Figure A.8:		Treatment increases probability of placement
Figure A.9:		Treatment increases probability of placement, but only if also given party mean info
Figure A.10:	Treatment has no aggregate effect on rating (pooled for all candidates)
Figure A.11:	Display of age/rurality within the subgroup of respondents who state not to know the candidate
Figure A.12:	Treatment interacted with age cues has no effect by party, irrespective of candidate knowledge
Figure A.13:	Treatment interacted with rurality cues has no effect by party, irrespective of candidate knowledge
Figure A.14:	Treatment has no consistent effect even if cues point in same direction
Figure A.15:	Treatment by party of candidate, interacted with age cues, has no consistent effect
Figure A.16:	Treatment by party of candidate, interacted with rurality cues, has no consistent effect
Figure A.17:	Age effect of table 1 with age cutoff reduced from 45 to 17
Figure A.18:	Age effect of figure 3 (interaction of treatment with "young age"-indicator, with age-indicator varied from 45 to 30
Figure A.19:	Age effect of figure 3, left panel (interaction of treatment with "young age"-indicator, with age-indicator varied from 45 to 30, by knowledge of candidate
Figure A.20:	Age effect of figure 4, left panel (interaction of treatment with "young age"-indicator by party, with age-indicator varied over full empirical lower range of party
*/
****************************************************************************************************************************************************************

****************************************************************************************************************************************************************
*prepare Stata

version 15
set more off
clear all
capture log close

/* if not already installed: install the following Stata packages in order to run this do-file:
ssc install mplotoffset, replace // by Nicholas Winter
ssc install grstyle, replace  //  by Ben Jann
ssc install estout, replace  // by Ben Jann
ssc install coefplot, replace  // by Ben Jann
*/

****************************************************************************************************************************************************************
*set working directory to folder containing the subfolder with replication data "data" and subfolders "tables" and "figures" 

*cd " " 


****************************************************************************************************************************************************************
*set global macros
global tab = "tables/"
global fig = "figures/"

****************************************************************************************************************************************************************
*set colorstyle grstyle for figures
grstyle init
grstyle set plain, horizontal grid
grstyle set color Dark2  
grstyle set legend, nobox

****************************************************************************************************************************************************************
*load data
use master_respondents.dta, clear

*labels for variables not to be reshaped
label variable pid "Respondent identifier"
label variable w4_q2 "Resp. gender == male"
label variable rurality "Resp. municipality type"
label variable env_score_ego "Resp. environmental score"
label variable age "Resp. age"
label variable agebin "Resp. age > 45 yrs"
label variable ruralcat "Resp. municipality type"
label variable candtreat "Treatment groups 1 and 4 with ballot cues shown"
label variable cuetreats "Cue treatments displayed"
label variable partytreats "Party treatments displayed"
label variable pol_interest "Political interest of respondent"
label variable party "PID of respondent"

*______________________________________________________________________________________________________________
****************************************************************************************************************************************************************
*TABLES AND FIGURES IN MAIN PAPER THAT DON'T USE RESHAPED DATA
*______________________________________________________________________________________________________________
****************************************************************************************************************************************************************

********************************************************************************
*Table 1: 
*Citizens' environmental score as predicted by demographics
********************************************************************************

eststo clear
eststo one: reg env_score_ego  i.agebin  , r
eststo two: reg env_score_ego  i.ruralcat , r
eststo three: reg env_score_ego  i.agebin i.ruralcat i.w4_q2  , r
eststo four: reg env_score_ego  i.agebin i.ruralcat i.w4_q2 i.party, r

esttab one two three four /// using "$tab\Table1.tex" ///
, stats(N r2 ) label  drop( 1.ruralcat 0.agebin 1.w4_q2) indicate(Control for PID = *party*) se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) 


********************************************************************************
*Table A.1: 
*Descriptive Statistics
********************************************************************************

preserve 
recode w4_q2 (1=0) (2=1)
rename ruralcat municipality_type

tab party, gen(party_indicator)
tab municipality_type, gen(municipality_type_tab)

eststo clear
eststo: estpost tabstat env_score_ego agebin municipality_type_tab? w4_q2 party_indicator?  /// 
,  columns(statistics) statistics(mean sd min max n) 

esttab . ///
/// using "$tab/TableA1.tex"  ///
, cells("mean(fmt(a2)) sd min max count") stats(N) label unstack replace

restore


********************************************************************************
*reshape

reshape long rate know place ek_name ek_info ek_female ek_party ek_partymean ek_age cand_agegroup cand_agegroup2 ek_rurality cand_ruralcat, i(pid) j(candidate)
 
*variable generation and labelling 

*labels for reshaped data
label variable candidate "Number of candidate displayed to respondent"
label variable ek_female "Candidate gender female"
label variable ek_age "Candidate age"
label variable ek_rurality "Candidate municipality"
label variable ek_name "Candidate name"
label variable ek_info "Candidate demographic information displayed to respondents"
label variable ek_party "Party of candidate"
label variable party_long1 "Name of party of candidate 1 displayed"
label variable party_long2 "Name of party of candidate 2 displayed"
label variable party_long3 "Name of party of candidate 3 displayed"
label variable ek_partymean "Mean of environmental score of candidate party"
label variable ek_treat "Treatment groups"
label variable rate "Candidate env. score"
label variable know "Respondent indicates knowledge of candidate"
label variable place "Resp. places candidate"
label variable cand_ruralcat "Cand. municipality type"
label variable cand_agegroup "Cand. age over 45"
label variable cand_agegroup2 "Three-categorical cand. age (below 45; 46-55; above 55)"

*For Figure 7
gen agelikeme = 0 
replace agelikeme = 1 if age - ek_age < 11 &  age - ek_age > -11
replace agelikeme = . if age >=. | ek_age >=.

gen rurallikeme = 0 
replace rurallikeme = 1 if (ruralcat  == cand_ruralcat )
replace rurallikeme = . if rurality >=. | ek_rurality >=.

gen everythinglikeme = 0
replace everythinglikeme = 1 if (age - ek_age < 11 &  age - ek_age > -11) & (ruralcat  == cand_ruralcat )
replace everythinglikeme = . if rurality >=. | ek_rurality >=. | age >=. | ek_age >=.

tab env_score_ego
recode env_score_ego (0/5.9999 = 0) (5.9999/10 = 1), gen(egogreenbrown) // split at median

label variable egogreenbrown "Green ego position"
label variable everythinglikeme "Candidate corresponds to ego"
label variable cuetreats "Cues displayed"
label variable ek_treat "Treatment groups"
label define ek_treat 1 "No info" 2 "Personal only" 3 "Party only" 4 "Party and personal", replace
label values ek_treat ek_treat
label variable know "Knowledge of candidate"
label variable place "Candidate placed"

*For Figure A.14

gen twogroups = .
replace twogroups = 0 if cand_agegroup == 1 & cand_ruralcat == 3
replace twogroups = 1 if cand_agegroup == 0 & cand_ruralcat == 1

*For Table A.8
label variable rate "Cand. env. score"
label variable cand_agegroup "Cand. age over 45"
label variable ek_age "Cand. age"
label variable cand_agegroup2 "Cand. age"
label define candagegroup2 0 "up to 45" 1 "46-55" 2 "55+", replace
label values cand_agegroup2 candagegroup2
label variable ek_female "Cand. female"
label variable ek_party "Party of candidate" 
label values ek_party party 

*For Figure A.20
label define party2 1 "CVP" 2 "FDP" 3 "SVP" 4 "SP" 5 "GP" 6 "GLP", replace

*additional labels
label variable agelikeme "Candidate corresponds to ego in age"
label variable rurallikeme "Candidate corresponds to ego in municipality type"
label variable twogroups "Most likely candidate cue display (urban and young candidate vs. rural and old candidate)"

*order dataset
order pid know ek_treat candtreat partytreat cuetreats partytreats  place rate  w4_q2 rurality env_score_ego age agebin pol_interest party agelikeme rurallikeme everythinglik~e egogreenbrown  ruralcat candidate ek_female ek_age ek_rurality ek_name ek_info ek_party party_long1 party_long2 party_long3 ek_partymean  cand_ruralcat cand_agegroup twogroups cand_agegroup2

 
*______________________________________________________________________________________________________________
****************************************************************************************************************************************************************
*FIGURES IN MAIN PAPER THAT USE RESHAPED DATA
*______________________________________________________________________________________________________________
****************************************************************************************************************************************************************

********************************************************************************
*Figure 2:
*Treatment increases probability of placement, but only in set of respondents 
*without prior candidate knowledge.
********************************************************************************

eststo one: mean place if know==0 , over(ek_treat ) cluster(pid)
eststo two: mean place if know==1, over(ek_treat ) cluster(pid)
coefplot (one, msymbol(o)) (two, msymbol(t)), byopts(row(4)) ylabel(1 "No cues" 2 "Personal only" 3 "Party only" 4 "Party and personal") xtitle("Probability of placement") /// xlabel(1(1)7 1 "Very bad" 7 "Very good")
legend(order(2 "Resp. does not know candidate" 4 "Resp. knows candidate") region(lcolor(white)) row(1))   
graph export "$fig\Figure2.png", width(3000) replace

********************************************************************************
*Figure 3:
*Treatment (revelation of ballot cues on age or rurality) does not affect placement.
*Conditional means for a binary indicator on respondents' placement of young 
*vs. old candidates (left panel) and urban vs. periurban vs. rural candidates 
*(right panel) on the 10-point environmental policy issue scale.
********************************************************************************

eststo clear

eststo one: mean rate if cuetreats==0 , over(cand_agegroup )  cluster(pid)
eststo two: mean rate if cuetreats==1 , over(cand_agegroup )  cluster(pid)

coefplot (one, msymbol(o) label(No candidate cues) mlabstyle(p1)) (two, msymbol(t) label(Candidate cues) mlabstyle(p1)), title(Age)    ///
ylabel( 1 "Young" 2 "Old"  , notick) xtitle("Rating of candidates")  ///
name(age, replace)


eststo one: mean rate if cuetreats==0 , over(cand_ruralcat ) cluster(pid)
eststo two: mean rate if cuetreats==1 , over(cand_ruralcat ) cluster(pid)

coefplot (one, msymbol(o) label(No candidate cues) mlabstyle(p1)) (two, msymbol(t) label(Candidate cues) mlabstyle(p1)), title(Rurality)    ///
ylabel( 1 "Urban" 2 "Periurban" 3 "Rural" , notick) xtitle("Rating of candidates")  ///
name(rural, replace)

graph combine age rural
graph export "$fig\Figure3.png", width(3000) replace

********************************************************************************
*Figure 4:
*Treatment (revelation of ballot cues on age or rurality) does not affect placement
*within party systematically. Conditional means for a binary indicator on respondents' 
*placement of young vs. old candidates (left panel) and urban vs. periurban vs.
*rural candidates (right panel) on the 10-point environmental policy issue scale. 
*Candidates are separated by the party they run for.
********************************************************************************

*age

eststo one: mean rate if cuetreats==0 , over(ek_party cand_agegroup ) cluster(pid)
eststo two: mean rate if cuetreats==1 , over(ek_party cand_agegroup ) cluster(pid)

coefplot (one, msymbol(o) label(No candidate cues) mlabstyle(p1)) (two, msymbol(t) label(Candidate cues) mlabstyle(p1)), title(Age) ytick(2.5 4.5 6.5 8.5 10.5, notick glpattern(dash) glcolor(gray))   ///
ylabel(1.5 "{bf:CVP         }" 1 "Young" 2 "Old" 3.5 "{bf:FDP         }" 3 "Young" 4 "Old" 5.5 "{bf:SVP         }" 5 "Young" 6 "Old" 7.5 "{bf:SP         }" 7 "Young" 8 "Old" 9.5 "{bf:GP         }" 9 "Young" 10 "Old" 11.5 "{bf:GLP         }" 11 "Young" 12 "Old" , notick) ///
name(age, replace) xtitle("Rating of candidates") 

*rurality

eststo one: mean rate if cuetreats==0 , over(ek_party cand_ruralcat ) cluster(pid)
eststo two: mean rate if cuetreats==1 , over(ek_party cand_ruralcat ) cluster(pid)

coefplot (one, msymbol(o) label(No candidate cues) mlabstyle(p1)) (two, msymbol(t) label(Candidate cues) mlabstyle(p1)), title(Rurality) ytick(3.5 5.5 8.5 11.5 13.5 15.5 , notick glpattern(dash) glcolor(gray))   /// 
ylabel(1.6 "{bf:CVP            }" 1 "Urban" 2 "P.urban" 3 "Rural" 4.6 "{bf:FDP            }" 4 "Urban" 5 "P.urban" 6.6 "{bf:SVP            }" 6 "Urban" 7 "P.urban" 8 "Rural" 9.6 "{bf:SP              }" 9 "Urban" 10 "P.urban" 11 "Rural" 12.6 "{bf:GP              }" 12 "Urban" 13 "P.urban" 14.6 "{bf:GLP              }" 14 "Urban" 15 "P.urban" , notick) ///
name(rural, replace) xtitle("Rating of candidates") 

graph combine age rural
graph export "$fig\Figure4.png", width(3000) replace

********************************************************************************
*Figure 5:
*Treatment increases probability of placement, but only if both party-mean and 
*cue treatment are experimentally revealed, and more so with low political interest.
********************************************************************************

eststo one: mean place if pol_interest==0  , over(ek_treat  ) cluster(pid)
eststo two: mean place if pol_interest==1  , over(ek_treat ) cluster(pid)
coefplot (one, msymbol(o)) (two, msymbol(t)), byopts(msymbol(o t) row(4)) ylabel(1 "No cues" 2 "Personal only" 3 "Party only" 4 "Party and personal") xtitle("Probability of placement") /// 
legend(order( 2 "Low pol. interest" 4 "High pol. interest") region(lcolor(white)) row(1))   xtitle("Probability of placement") 
graph export "$fig\Figure5.png", width(3000) replace

********************************************************************************
*Figure 6:
*Treatment has no specific effects within populations of high/low political interest.
********************************************************************************

*age rurality polint
eststo clear

eststo one: mean rate if cuetreats==0 , over(pol_interest cand_agegroup ) cluster(pid)
eststo two: mean rate if cuetreats==1 , over(pol_interest cand_agegroup ) cluster(pid)

coefplot (one, msymbol(o) label(No cand. cues) mlabstyle(p1)) (two, msymbol(t) label(Cand. cues) mlabstyle(p1)), title(Age) ytick(2.5  ,  glpattern(dash) glcolor(gray))   ///
ylabel( 0.5 "{bf: Low interest    }" 1 "Young" 2 "Old" 2.5 "{bf: High interest    }" 3 "Young" 4 "Old"  , notick) legend(region(lcolor(white)) row(1)) ///
name(age, replace) xtitle("Rating of candidates") 

*rurality

eststo one: mean rate if cuetreats==0 , over(pol_interest cand_ruralcat ) cluster(pid)
 eststo two: mean rate if cuetreats==1 , over( pol_interest cand_ruralcat ) cluster(pid)

coefplot (one, msymbol(o) label(No cand. cues) mlabstyle(p1)) (two, msymbol(t) label(Cand. cues) mlabstyle(p1)), title(Rurality)  ytick(3.5  , notick glpattern(dash) glcolor(gray))  ///
ylabel( 0.5 "{bf: Low interest    }" 1 "Urban" 2 "Periurban" 3 "Rural" 3.5 "{bf: High interest    }" 4 "Urban" 5 "Periurban" 6 "Rural"  , notick) legend(region(lcolor(white)) row(1)) ///
name(rural, replace) xtitle("Rating of candidates") 

graph combine age rural
graph export "$fig\Figure6.png", width(3000) replace

********************************************************************************
*Figure 7:
*Predicted candidate placement by whether a respondent is green (above median 
*environmental score) or brown (below median environmental score), by whether 
*the candidate to be placed differs on demographics to the respondent or resembles
*the respondent, and by treatment group (ballot information not provided vs provided).
********************************************************************************

eststo clear
eststo: reg rate i.egogreenbrown##i.everythinglikeme##i.cuetreats , cluster(pid) coeflegend

margins cuetreats, at(egogreenbrown = (0 1) everythinglikeme = (0 1) )  
marginsplot, by(everythinglikeme) 

mplotoffset, offset(0.25) by(everythinglikeme, label("Candidate does not resemble ego" "Candidate does resemble ego")) recast(scatter) xscale(range(-0.4 1.4)) ///
legend(order(3 "No candidate cues" 4 "Candidate cues") row(1) pos(1) ring(0)  region(lcolor(white))) xtitle("Ego is green (1=yes, 0=no)") ytitle("Prediction of cand. environmental score") ///
byopt(title( "" )) plot1opts(msymbol(circle)  ) plot2opts(msymbol(triangle))  ciopts(recast(rspike)) 

graph export "$fig\Figure7.png", width(3000) replace


*______________________________________________________________________________________________________________
****************************************************************************************************************************************************************
*FIGURES IN APPENDIX
*______________________________________________________________________________________________________________
****************************************************************************************************************************************************************
 
********************************************************************************
*Figure A.1:
*Kernel-weighted local polynomial smooth plot of environmental score age with
*local mean smoothing and 95% confidence interval. Age restricted to range 17-85.
********************************************************************************

grstyle set ci 
twoway lpolyci env_score_ego age if age<85 & candidate == 1  // candidate == 1 restricts data to use only one observation per respondent
graph export "$fig\FigureA1.png", replace width(2000)
 
********************************************************************************
*Figure A.2:
*Conditional means for a binary indicator whether respondent states that she does 
*not know a candidate (0) or that she knows a candidate (1) by two experimental 
*conditions (0: no candidate information displayed; 1: age, residence displayed). 
*95% confidence intervals displayed.
********************************************************************************

mean know, over(candtreat ) cluster(pid)
coefplot  , byopts( row(2)) ylabel(1 "No candidate cues" 2 "Candidate cues") xtitle("Stated knowledge of candidate") 
graph export "$fig\FigureA2.png", replace width(2000)

********************************************************************************
*Figure A.8:
*Treatment increases probability of placement. Conditional means for a binary indicator
*whether respondent does not place a candidate (0) or does place (1) by two experimental 
*conditions (0: control group, only candidate name and party affiliation or only name, 
*party affiliation and party mean displayed; 1: additionally age and residence displayed. 
*95% confidence intervals from robust standard errors shown.
********************************************************************************

mean place, over(candtreat ) cluster(pid)
coefplot  , byopts( row(2)) ylabel(1 "No candidate cues" 2 "Candidate cues") xtitle("Probability of placement") 
graph export "$fig\FigureA8.png", replace width(2000)

********************************************************************************
*Figure A.9:
*Treatment increases probability of placement, but only if also given party mean info. 
*Conditional means for a binary indicator whether respondent does not place a candidate (0) 
*or does place (1) by four experimental conditions (0: control group, only candidate 
*name and party affiliation displayed; 1: name, party affiliation, age, residence displayed; 
*2: name, party affiliation and party mean displayed; 3: name, party affiliation, age, 
*residence and party mean displayed. 95\% confidence intervals from robust standard errors displayed.
********************************************************************************

mean place, over(ek_treat ) cluster(pid)

coefplot  , byopts( row(4)) ylabel(1 "No cues" 2 "Personal only" 3 "Party only" 4 "Party and personal") xtitle("Probability of placement") 
graph export "$fig\FigureA9.png", replace width(2000)

********************************************************************************
*Figure A.10:
*Treatment has no aggregate effect on rating (pooled for all candidates). Conditional 
*means for 10-point environmental protection scale (1 min, 10 max) by two experimental 
*conditions (0: control group, only candidate name and party affiliation or only name, 
*party affiliation and party mean displayed; 1: additionally age and residence displayed. 
*95\% confidence intervals from robust standard errors shown.
********************************************************************************

mean rate, over(candtreat ) cluster(pid)
coefplot  , byopts( row(2)) ylabel(1 "No candidate cues" 2 "Candidate cues") xtitle("Rating of candidates") 
graph export "$fig\FigureA10.png", replace width(2000)

********************************************************************************
*Figure A.11:
*Display of age/rurality within the subgroup of respondents who state not to know 
*the candidate. 95\% confidence intervals from robust standard errors displayed.
********************************************************************************

*overall w/o knowledge
preserve
keep if know==0
eststo clear

eststo one
eststo one: mean rate if cuetreats==0 , over(cand_agegroup ) 

eststo two
 eststo two: mean rate if cuetreats==1 , over(cand_agegroup ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)), title(Age)    ///
ylabel( 1 "Young" 2 "Old"  , notick ) ///
name(age, replace) xtitle("Rating of candidates") 

*rurality
eststo one
eststo one: mean rate if cuetreats==0 , over(cand_ruralcat ) 

eststo two
 eststo two: mean rate if cuetreats==1 , over(cand_ruralcat ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)), title(Rurality)    ///
ylabel( 1 "Urban" 2 "Periurban" 3 "Rural" , notick) ///
name(rural, replace) xtitle("Rating of candidates") 

graph combine age rural
 graph export "$fig\FigureA11.png", replace width(2000)
restore

********************************************************************************
*Figure A.12:
*Treatment interacted with age cues has no effect by party, irrespective of 
*candidate knowledge
********************************************************************************

eststo one: mean rate if cuetreats==0 & know==1, over(ek_party cand_agegroup ) 

eststo two: mean rate if cuetreats==1 & know==1, over(ek_party cand_agegroup ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)), title(no knowledge) ///
ylabel(0.5 "{bf:CVP         }" 1 "Young" 2 "Old" 2.5 "{bf:FDP         }" 3 "Young" 4 "Old" 4.5 "{bf:SVP         }" 5 "Young" 6 "Old" 6.5 "{bf:SP         }" 7 "Young" 8 "Old" 8.5 "{bf:GP         }" 9 "Young" 10 "Old" 10.5 "{bf:GLP         }" 11 "Young" 12 "Old" , notick) ///
ytick(2.5 4.5 6.5 8.5 10.5, notick glpattern(dash) glcolor(gray)) name(know, replace) xtitle("Rating of candidates") 


eststo one: mean rate if cuetreats==0 & know==0, over(ek_party cand_agegroup ) 

eststo two: mean rate if cuetreats==1 & know==0, over(ek_party cand_agegroup ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)), title(knowledge) ///
ylabel(0.5 "{bf:CVP         }" 1 "Young" 2 "Old" 2.5 "{bf:FDP         }" 3 "Young" 4 "Old" 4.5 "{bf:SVP         }" 5 "Young" 6 "Old" 6.5 "{bf:SP         }" 7 "Young" 8 "Old" 8.5 "{bf:GP         }" 9 "Young" 10 "Old" 10.5 "{bf:GLP         }" 11 "Young" 12 "Old" , notick) ///
ytick(2.5 4.5 6.5 8.5 10.5, notick glpattern(dash) glcolor(gray)) name(noknow, replace) xtitle("Rating of candidates") 

graph combine know noknow 
 
graph export "$fig\FigureA12.png", replace width(2000)
 
********************************************************************************
*Figure A.13:
*Treatment interacted with rurality cues has no effect by party, irrespective 
*of candidate knowledge
********************************************************************************

eststo one: mean rate if cuetreats==0 & know==1, over(ek_party cand_ruralcat ) 
eststo two: mean rate if cuetreats==1 & know==1, over(ek_party cand_ruralcat ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)),  title(Knowledge) ///
ytick(3.5 5.5 8.5 11.5 13.5 15.5 , notick glpattern(dash) glcolor(gray))   /// 
ylabel(1.6 "{bf:CVP            }" 1 "Urban" 2 "P.urban" 3 "Rural" 4.6 "{bf:FDP            }" 4 "Urban" 5 "P.urban" 6.6 "{bf:SVP            }" 6 "Urban" 7 "P.urban" 8 "Rural" 9.6 "{bf:SP              }" 9 "Urban" 10 "P.urban" 11 "Rural" 12.6 "{bf:GP              }" 12 "Urban" 13 "P.urban" 14.6 "{bf:GLP              }" 14 "Urban" 15 "P.urban" , notick) ///
name(know, replace) xtitle("Rating of candidates") 

eststo one: mean rate if cuetreats==0 & know==0, over(ek_party cand_ruralcat ) 
eststo two: mean rate if cuetreats==1 & know==0, over(ek_party cand_ruralcat ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)),  title(No knowledge) ///
ytick(3.5 5.5 8.5 11.5 13.5 15.5 , notick glpattern(dash) glcolor(gray))   /// 
ylabel(1.6 "{bf:CVP            }" 1 "Urban" 2 "P.urban" 3 "Rural" 4.6 "{bf:FDP            }" 4 "Urban" 5 "P.urban" 6.6 "{bf:SVP            }" 6 "Urban" 7 "P.urban" 8 "Rural" 9.6 "{bf:SP              }" 9 "Urban" 10 "P.urban" 11 "Rural" 12.6 "{bf:GP              }" 12 "Urban" 13 "P.urban" 14.6 "{bf:GLP              }" 14 "Urban" 15 "P.urban" , notick) ///
name(noknow, replace) xtitle("Rating of candidates") 

graph combine know noknow

graph export "$fig\FigureA13.png", replace width(2000)

********************************************************************************
*Figure A.14:
*Treatment has no consistent effect even if cues point in same direction 
*(subset of old/rural candidates and young/urban candidates)
********************************************************************************
 
eststo one: mean rate if cuetreats==0 , over(ek_party twogroups ) 
eststo two: mean rate if cuetreats==1  , over(ek_party twogroups ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)),  title(Rating) ///
ylabel(0.5 "{bf:CVP         }" 1 "Old & rural  " 2 "Young & urban" 2.5 "{bf:FDP         }" 3 "Young & urban" 3.5 "{bf:SVP         }" 4 "Old & rural  " ///
5 "Young & urban" 5.5 "{bf:SP          }" 6 "Young & urban"  6.5 "{bf:GLP         }" 7  "Young & urban", notick ) ///
ytick(  2.5 3.5 5.5 6.5, notick glpattern(dash) glcolor(gray))  graphregion(margin(l=5)) xtitle("Rating of candidates") 

graph export "$fig\FigureA14.png", replace width(2000)

********************************************************************************
*Figure A.15:
*Treatment by party of candidate, interacted with age cues, has no consistent effect
********************************************************************************
 
eststo one: mean rate if cuetreats==0 & pol_interest==0, over( ek_party cand_agegroup ) 
eststo two: mean rate if cuetreats==1 & pol_interest==0, over( ek_party cand_agegroup ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)), title(Age and low pol. interest) ytick(2.5 4.5 6.5 8.5 10.5, notick glpattern(dash) glcolor(gray))   ///
ylabel(1.5 "{bf:CVP         }" 1 "Young" 2 "Old" 3.5 "{bf:FDP         }" 3 "Young" 4 "Old" 5.5 "{bf:SVP         }" 5 "Young" 6 "Old" 7.5 "{bf:SP         }" 7 "Young" 8 "Old" 9.5 "{bf:GP         }" 9 "Young" 10 "Old" 11.5 "{bf:GLP         }" 11 "Young" 12 "Old" , notick) ///
name(agelow, replace) xtitle("Rating of candidates") 
 
eststo one: mean rate if cuetreats==0 & pol_interest==1, over( ek_party cand_agegroup ) 
eststo two: mean rate if cuetreats==1 & pol_interest==1, over(ek_party cand_agegroup ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)), title(Age and high pol. interest) ytick(2.5 4.5 6.5 8.5 10.5, notick glpattern(dash) glcolor(gray))   ///
ylabel(1.5 "{bf:CVP         }" 1 "Young" 2 "Old" 3.5 "{bf:FDP         }" 3 "Young" 4 "Old" 5.5 "{bf:SVP         }" 5 "Young" 6 "Old" 7.5 "{bf:SP         }" 7 "Young" 8 "Old" 9.5 "{bf:GP         }" 9 "Young" 10 "Old" 11.5 "{bf:GLP         }" 11 "Young" 12 "Old" , notick) ///
name(agehigh, replace) xtitle("Rating of candidates") 

graph combine agelow agehigh
graph export "$fig\FigureA15.png", replace width(2000)

********************************************************************************
*Figure A.16:
*Treatment by party of candidate, interacted with rurality cues, has no consistent  effect
********************************************************************************


eststo one: mean rate if cuetreats==0 & pol_interest==0, over( ek_party cand_ruralcat ) 
eststo two: mean rate if cuetreats==1 & pol_interest==0, over( ek_party cand_ruralcat ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)), title(Rurality and low pol. interest) ytick(3.5 5.5 8.5 11.5 13.5 15.5 , notick glpattern(dash) glcolor(gray))   /// 
ylabel(1.6 "{bf:CVP            }" 1 "Urban" 2 "P.urban" 3 "Rural" 4.6 "{bf:FDP            }" 4 "Urban" 5 "P.urban" 6.6 "{bf:SVP            }" 6 "Urban" 7 "P.urban" 8 "Rural" 9.6 "{bf:SP              }" 9 "Urban" 10 "P.urban" 11 "Rural" 12.6 "{bf:GP              }" 12 "Urban" 13 "P.urban" 14.6 "{bf:GLP              }" 14 "Urban" 15 "P.urban" , notick) ///
name(rurallow, replace) xtitle("Rating of candidates") 

eststo one: mean rate if cuetreats==0 & pol_interest==1, over( ek_party cand_ruralcat ) 
eststo two: mean rate if cuetreats==1 & pol_interest==1, over( ek_party cand_ruralcat ) 

coefplot (one, label(No candidate cues) mlabstyle(p1)) (two, label(Candidate cues) mlabstyle(p1)), title(Rurality and high pol. interest) ytick(3.5 5.5 8.5 11.5 13.5 15.5 , notick glpattern(dash) glcolor(gray))   /// 
ylabel(1.6 "{bf:CVP            }" 1 "Urban" 2 "P.urban" 3 "Rural" 4.6 "{bf:FDP            }" 4 "Urban" 5 "P.urban" 6.6 "{bf:SVP            }" 6 "Urban" 7 "P.urban" 8 "Rural" 9.6 "{bf:SP              }" 9 "Urban" 10 "P.urban" 11 "Rural" 12.6 "{bf:GP              }" 12 "Urban" 13 "P.urban" 14.6 "{bf:GLP              }" 14 "Urban" 15 "P.urban" , notick) ///
name(ruralhigh, replace) xtitle("Rating of candidates") 

graph combine rurallow ruralhigh
graph export "$fig\FigureA16.png", replace width(2000)

********************************************************************************
*Figure A.17:
*Age effect of table 1 with age cutoff reduced from 45 to 17 
*(full empirical lower range)
********************************************************************************

eststo clear
forvalues x = 17/45 {
capture drop agebin2
local cutoff = `x'+1
di `cutoff'
recode age (1/`x'=0) (`cutoff'/106=1), gen(agebin2) // label variable agebin2 "Candidate age indicator for cut-off analysis"
eststo run`x': reg env_score_ego  ib1.agebin2 i.cand_ruralcat i.w4_q2 if candidate==1 , r
eststo runcont`x': reg env_score_ego  ib1.agebin2 i.cand_ruralcat i.w4_q2 i.party if candidate==1, r
}
coefplot run??, title("Without controls") keep(*agebin2*) legend(off) xline(0) scheme(plotplain) name(one, replace) ///
ylabel(0.533 "17" 0.633 "20" 0.800 "25" 0.967 "30" 1.134 "35" 1.301 "40" 1.468 "45") xtitle("Resp. env. score")
coefplot runcont??, title("With controls") keep(*agebin2*) legend(off) xline(0) scheme(plotplain) name(two, replace) ///
ylabel(0.533 "17" 0.633 "20" 0.800 "25" 0.967 "30" 1.134 "35" 1.301 "40" 1.468 "45") xtitle("Resp. env. score")

graph combine one two

graph export "$fig\FigureA17.png", replace width(2000)

********************************************************************************
*Figure A.18:
*Age effect of figure 3 (interaction of treatment with "young age"-indicator, 
*with age-indicator varied from 45 to 30 (full empirical lower range)
********************************************************************************

eststo clear

foreach x in 30 31 33 36 37 38 39 40 42 43 44 45 {
capture drop cand_agegroup2
local cutoff = `x'+1
di `cutoff'
recode ek_age (1/`x'=0) (`cutoff'/80=1), gen(cand_agegroup2)
eststo run`x': reg rate cuetreats##ib1.cand_agegroup2   , cluster(pid)
}
coefplot run??, title("Pooled by party") keep(*cuetreats*cand_agegroup2*) legend(off) xline(0) ///
ylabel(0.57 "30" .648 "31" 0.725 "33" .803 "36" .881 "37" .959 "38" 1.036 "39" 1.114 "40" 1.192 "42" 1.27 "43" 1.347 "44" 1.425 "45") scheme(plotplain) xtitle("Rating of candidates") 

graph export "$fig\FigureA18.png", replace width(2000)

********************************************************************************
*Figure A.19:
*Age effect of figure 3, left panel (interaction of treatment with "young age"-indicator,
* with age-indicator varied from 45 to 30 (full empirical lower range), by knowledge of candidate
********************************************************************************

eststo clear

foreach x in 30 31 33 36 37 38 39 40 42 43 44 45 {
capture drop cand_agegroup2
local cutoff = `x'+1
di `cutoff'
recode ek_age (1/`x'=0) (`cutoff'/80=1), gen(cand_agegroup2)
eststo run`x': reg rate cuetreats##ib1.cand_agegroup2 if know==1 , cluster(pid)
}
coefplot run??, title("Pooled by party, resp. with knowledge") keep(*cuetreats*cand_agegroup2*) legend(off) xline(0) name(one, replace) ///
ylabel(0.575 "30" .652 "31" 0.73 "33" .807 "36" .884 "37" .961 "38" 1.039 "39" 1.116 "40" 1.193 "42" 1.27 "43" 1.348 "44" 1.425 "45") scheme(plotplain) xtitle("Rating of candidates") 

*overall no knowledge
eststo clear

foreach x in 30 31 33 36 37 38 39 40 42 43 44 45 {
capture drop cand_agegroup2
local cutoff = `x'+1
di `cutoff'
recode ek_age (1/`x'=0) (`cutoff'/80=1), gen(cand_agegroup2)
eststo run`x': reg rate cuetreats##ib1.cand_agegroup2 if know==0 , cluster(pid)
}
coefplot run??, title("Pooled by party, resp. without knowledge") keep(*cuetreats*cand_agegroup2*) legend(off) xline(0) name(two, replace) ///
ylabel(0.575 "30" .652 "31" 0.73 "33" .807 "36" .884 "37" .961 "38" 1.039 "39" 1.116 "40" 1.193 "42" 1.27 "43" 1.348 "44" 1.425 "45") scheme(plotplain) xtitle("Rating of candidates") 

graph combine one two

graph export "$fig\FigureA19.png", replace width(2000)

********************************************************************************
*Figure A.20:
*Age effect of figure 4, left panel (interaction of treatment with "young age"-indicator 
*by party, with age-indicator varied over full empirical lower range of party 
*(as indicated on y-axis))
********************************************************************************

local party1 = "30 31 50"
local party2 = "38 39 42 44 45 "
local party3 = "36 40 43 48 "
local party4 = "30 33 36 40 49 "
local party5 = "37 44 50"
local party6 = "39 40 47"

local label1 = `"0.75 "30"  1 "31"  1.25 "50" "'
local label2 = `"0.66 "38" 0.8275 "39" 0.995 "42" 1.1625 "44" 1.33 "45" "'
local label3 = `"0.7 "36"  0.9  "40"  1.1 "43" 1.3 "48"  "'
local label4 = `"0.66 "30" 0.8275 "33"  0.995 "36"  1.1625 "40" 1.33 "49" "'
local label5 = `"0.75 "37"  1 "44"  1.25 "50" "'
local label6 = `"0.75 "39"  1 "40"  1.25 "47" "'

foreach z in 1 2 3 4 5 6 { // 
local v : label party2 `z'
eststo clear
foreach x in `party`z'' {
capture drop cand_agegroup2
local cutoff = `x'+1
di `cutoff'
recode ek_age (1/`x'=0) (`cutoff'/80=1), gen(cand_agegroup2)
eststo run`x': reg rate cuetreats##ib1.cand_agegroup2 if ek_party==`z' , cluster(pid)
}
coefplot run??, keep(*cuetreats*cand_agegroup2*) legend(off) xline(0) title("`v'") ylabel(`label`z'') name(party`z', replace) scheme(plotplain) xtitle("Rating of candidates") //  
}
graph combine party3 party2 party1 party6 party4 party5 

graph export "$fig\FigureA20.png", replace width(2000)


*______________________________________________________________________________________________________________
****************************************************************************************************************************************************************
*TABLES IN APPENDIX
*______________________________________________________________________________________________________________
****************************************************************************************************************************************************************

********************************************************************************
*Table A.5:
*A "like-me"-heuristic?
********************************************************************************

eststo clear
eststo rurality: reg rate i.egogreenbrown##i.rurallikeme##i.cuetreats  , cluster(pid)
eststo age: reg rate i.egogreenbrown##i.agelikeme##i.cuetreats  , cluster(pid)
eststo both: reg rate i.egogreenbrown##i.everythinglikeme##i.cuetreats  , cluster(pid) coeflegend
esttab /// using "$tab\TableA5.tex" ///
, stats(N   ) label drop(0.*) se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted ///
rename(1.agelikeme 1.everythinglikeme 1.rurallikeme 1.everythinglikeme 1.egogreenbrown#1.agelikeme 1.egogreenbrown#1.everythinglikeme 1.egogreenbrown#1.rurallikeme 1.egogreenbrown#1.everythinglikeme ///
1.agelikeme#1.cuetreats 1.everythinglikeme#1.cuetreats 1.rurallikeme#1.cuetreats 1.everythinglikeme#1.cuetreats ///
1.egogreenbrown#1.agelikeme#1.cuetreats 1.egogreenbrown#1.everythinglikeme#1.cuetreats 1.egogreenbrown#1.rurallikeme#1.cuetreats 1.egogreenbrown#1.everythinglikeme#1.cuetreats) mtitle

********************************************************************************
*Table A.6:
*"Like-me"-heuristic is more pronounced if party mean treatment is also shown
********************************************************************************

eststo clear
eststo rurality: reg rate i.egogreenbrown##i.rurallikeme##i.cuetreats if partytreat==1, cluster(pid)
eststo age: reg rate i.egogreenbrown##i.agelikeme##i.cuetreats if partytreat==1 , cluster(pid)
eststo both: reg rate i.egogreenbrown##i.everythinglikeme##i.cuetreats  if partytreat==1, cluster(pid) coeflegend
esttab  /// using "$tab\TableA6.tex" ///
, stats(N   ) label drop(0.*) se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted ///
rename(1.agelikeme 1.everythinglikeme 1.rurallikeme 1.everythinglikeme 1.egogreenbrown#1.agelikeme 1.egogreenbrown#1.everythinglikeme 1.egogreenbrown#1.rurallikeme 1.egogreenbrown#1.everythinglikeme ///
1.agelikeme#1.cuetreats 1.everythinglikeme#1.cuetreats 1.rurallikeme#1.cuetreats 1.everythinglikeme#1.cuetreats ///
1.egogreenbrown#1.agelikeme#1.cuetreats 1.egogreenbrown#1.everythinglikeme#1.cuetreats 1.egogreenbrown#1.rurallikeme#1.cuetreats 1.egogreenbrown#1.everythinglikeme#1.cuetreats) mtitle

********************************************************************************
*Table A.7:
*"Like-me"-heuristic is more pronounced if respondent reports knowing the candidate
********************************************************************************

eststo clear
eststo rurality: reg rate i.egogreenbrown##i.rurallikeme##i.cuetreats if know==1 , cluster(pid)
eststo age: reg rate i.egogreenbrown##i.agelikeme##i.cuetreats if know==1 , cluster(pid)
eststo both: reg rate i.egogreenbrown##i.everythinglikeme##i.cuetreats  if know==1, cluster(pid) coeflegend
esttab  /// using "$tab\TableA7.tex" ///
, stats(N   ) label drop(0.*) se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted ///
rename(1.agelikeme 1.everythinglikeme 1.rurallikeme 1.everythinglikeme 1.egogreenbrown#1.agelikeme 1.egogreenbrown#1.everythinglikeme 1.egogreenbrown#1.rurallikeme 1.egogreenbrown#1.everythinglikeme ///
1.agelikeme#1.cuetreats 1.everythinglikeme#1.cuetreats 1.rurallikeme#1.cuetreats 1.everythinglikeme#1.cuetreats ///
1.egogreenbrown#1.agelikeme#1.cuetreats 1.egogreenbrown#1.everythinglikeme#1.cuetreats 1.egogreenbrown#1.rurallikeme#1.cuetreats 1.egogreenbrown#1.everythinglikeme#1.cuetreats) mtitle

********************************************************************************
*Table A.8:
*Robustness tests for main effects of Figure 3 with three-categorical and 
*continouus modelling of age and with and without control variables
********************************************************************************

*reset correct cand. age variable

capture drop cand_agegroup2
gen cand_agegroup2 = ek_age>45
replace cand_agegroup2 = 2 if ek_age>55
label variable cand_agegroup2 "Cand. age"

eststo clear
eststo: reg rate ib1.cand_agegroup##i.cuetreats 
eststo: reg rate ib3.cand_agegroup2##i.cuetreats 
eststo: reg rate c.ek_age##i.cuetreats 

eststo: reg rate ib1.cand_agegroup##i.cuetreats i.cand_ruralcat##i.cuetreats i.ek_party ek_female
eststo: reg rate ib3.cand_agegroup2##i.cuetreats i.cand_ruralcat##i.cuetreats i.ek_party ek_female
eststo: reg rate c.ek_age##i.cuetreats i.cand_ruralcat##i.cuetreats i.ek_party ek_female

esttab  /// using "$tab\TableA8.tex" ///
, stats(N  ) label  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted nobaselevels  

********************************************************************************
*Table A.9:
*Regression table for results presented in Figure 2
********************************************************************************
eststo clear

eststo: reg place i.ek_treat if know==0, cluster(pid)
eststo: logit place i.ek_treat if know==0, cluster(pid)
eststo: reg place i.ek_treat if know==1, cluster(pid)
eststo: logit place i.ek_treat if know==1, cluster(pid)

esttab /// using "$tab\TableA9.tex" ///
, stats(N   ) label  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted nobaselevels eqlabels(" " " ") ///
mgroups("No knowledge of candidate" "Knowledge of candidate", pattern(1 0  1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span) ///
refcat(_cons "Estimation model", below label("OLS" "logit"  ))

********************************************************************************
*Table A.10:
*Regression table for results presented in Figure 3
********************************************************************************

eststo clear

eststo: reg rate i.cuetreats##i.cand_agegroup, cluster(pid)
eststo: reg rate i.cuetreats##i.cand_ruralcat, cluster(pid)

esttab /// using "$tab\TableA10.tex" ///
, stats(N   ) label  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted nobaselevels eqlabels(" " " ")  

********************************************************************************
*Table A.11:
*Regression table for results presented in Figure 4
********************************************************************************
 
eststo clear

foreach x in 1 2 3 4 5 6 {
eststo one`x': reg rate i.cuetreats##i.cand_agegroup if ek_party == `x', cluster(pid)

eststo two`x': reg rate i.cuetreats##i.cand_ruralcat  if ek_party == `x', cluster(pid)
}
esttab one3 two3 one2 two2 one1 two1 one6 two6 one4 two4 one5 two5  /// using "$tab\TableA11.tex" ///
, stats(N   ) label  p nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted nobaselevels eqlabels(" " " ")  ///
mgroups(SVP FDP CVP GLP SP GP, pattern(1 0  1 0 1 0 1 0 1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span)

********************************************************************************
*Table A.12:
*Regression table for results presented in Figure 5
********************************************************************************

eststo clear

eststo: reg place i.ek_treat if pol_interest==0, cluster(pid)
eststo: logit place i.ek_treat if pol_interest==0, cluster(pid)
eststo: reg place i.ek_treat if pol_interest==1, cluster(pid)
eststo: logit place i.ek_treat if pol_interest==1, cluster(pid)

esttab  /// using "$tab\TableA12.tex" ///
, stats(N   ) label  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted nobaselevels eqlabels(" " " ") ///
mgroups("Low political interest  " "High political interest  ", pattern(1 0  1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span) ///
refcat(_cons "Estimation model", below label("OLS" "logit"  ))

********************************************************************************
*Table A.13:
*Regression table for results presented in Figure 6
********************************************************************************

eststo clear

eststo: reg rate i.cuetreats##i.cand_agegroup if pol_interest == 0, cluster(pid)
eststo: reg rate i.cuetreats##i.cand_ruralcat if pol_interest == 0, cluster(pid)
eststo: reg rate i.cuetreats##i.cand_agegroup if pol_interest == 1, cluster(pid)
eststo: reg rate i.cuetreats##i.cand_ruralcat if pol_interest == 1, cluster(pid)

esttab /// using "$tab\TableA13.tex" ///
, stats(N   ) label  se nonote replace star(+ 0.1 * 0.05 ** 0.01 *** 0.001) noomitted nobaselevels eqlabels(" " " ")  ///
mgroups("Low political interest  " "High political interest  ", pattern(1 0  1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span)  

 
 
**************
* END 
 
   